Get Assigned WorkItems
Overview
Bizagi offers a function to obtain an array of the WorkItems assigned to a given user.
Syntax
CHelper.getAssignedWorkItems(Me, CaseId, CurrentAssigneeId, IncludeSubProcesses)
Attributes
- Me: Fixed value.
- CaseId: Case ID.
- CurrentAssigneeId: The current assignee's ID.
- IncludeSubProcesses: If you wish to include sub-processes, set this parameter to
true
.
Example
In the following sample rule, we obtain the creator user's assigned WorkItems for a simple process. This rule is executed On Enter for the task Simple Example.
The code is as follows
var myWorkItems = CHelper.getAssignedWorkItems(Me, Me.Case.Id, Me.Case.Creator.Id, false);
for(var i=0;i<myWorkItems.Count;i++){
var Newrecord = Me.newCollectionItem("SimpleProcess.AssignedWorkItems");
var workItem=myWorkItems[i];
Newrecord.setXPath("TaskName",workItem.Task.DisplayName);
}
Result Collection
The collection is displayed as shown below: